export default {
    name: 'QuitDialog',
    props: {
        quitOrderFlag: Boolean,
        quitForDialog: {
            type: Object
        }
    },
    data() {
        return {
            // 退单原因
            chargebackReason: ''
        };
    },
    methods: {
        clonseDialog() {
            this.$emit('closeDialog');
        },
        // 提交
        quitOrder() {
            this.$httpExt()
                .post('/api/pmsSupplierWorkOrder/chargeback', {
                    // id
                    workOrderId: this.quitForDialog.workOrderId,
                    // 退单原因
                    chargebackReason: this.quitForDialog.chargebackReason
                })
                .then(
                    response => {
                        console.log('返回值', response.data);
                        this.$message({
                            message: '申请成功',
                            type: 'success'
                        });
                        this.clonseDialog();
                    },
                    response => {
                        Notification.error({
                            title: '异常',
                            message: response.msg
                        });
                    }
                )
                .catch(err => {
                    console.log('异常', err);
                });
        }
    }
};
